============================================================================= FC256VBX - A package of 256 color, palette aware controls - and more. ============================================================================= THIS ZIP FILE CONTAINS: README TXT - This file FCLINE VBX - Custom control - see documentation below FCBTN VBX FCSLATE VBX FCHOTTXT VBX FCODDPIC VBX FCPSHBTN VBX FCSHAPE VBX FCTXTBTN VBX FCOPT VBX FCCHK VBX FCLABEL VBX DEMO FRM - Sample demo file - VB 3.0 format DEMO FRX - Sample demo file - VB 3.0 format DEMO MAK - Sample demo file - VB 3.0 format MAGNIFY DIB - Image used in demo ============================================================================= REGISTRATION: You can register this Control by on-line registration with Compuserve, type GO SWREG and register product number 4098. The fee is $50.00. A registered copy will be sent by E-Mail to your Compuserve account. Registering the control will get the registered runtime version of the control. ============================================================================= HOW TO REACH US: If you have any comments or questions, please send mail them to CIS 100275,3556 The above .VBX files may not be commercially distributed, used for applications other than trial use, distributed by government agencies or any of its contractors, UNLESS a registration fee is paid by the distributing party. A registered control may be distributed with the applications that use it at no additional cost. This trial use file may be only distributed in its entirety. This file may not be included in CD-ROM distributions, bundled with other files, or offered for retail sale without contacting the author at the above CIS email address and obtaining a license to redistribute FC256VBX. ============================================================================= Custom Control Documentation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There will be a short description for each control and then an explanation of the non-standard properties. Some Visual Basic examples may also be included. FCLine ====== Description ~~~~~~~~~~~ This allows you to draw an animated line on a form. The line is sized by dragging the box and the direction of the line is set using the Angle Property. The line can be Horizontal, Vertical or Diagonal, which should about cover all eventualities. Properties ~~~~~~~~~~ Angle Can be '0-Horizontal', '1-Vertical', '2-Left Diagonal' (goes from top left to bottom right) or '3-Right Diagonal' (goes from top right to bottom left). Once the Angle has been set the Control can be resized to change the length of the line. Color The colour of the line. Delay This is the delay of the animation. It is in milliseconds. An average Delay would be about 20. The maximum Delay is 100 (This is quite slow and so very unlikely to be used). Direction Can be '0-Left to Right' or '1-Right to Left'. If it is 'Left to Right' then the line will start drawing on the left hand side of the screen and move towards the right. If you are drawing a vertical line then 'Left to Right' means it will draw from 'Top to Bottom' ('Right to Left' means it will draw from 'Bottom to Top' for a vertical line). Enabled This is not the same as enabling and disabling a normal control. This is used to turn the animation On and Off. When Enabled is set to True the line will wipe in run mode. When Enabled is set to false the line will just be drawn on the form in one go. The idea is that after the line has been drawn the first time with Enabled set to True, you set it to False so the line is just drawn normally. Line Width This is the width of the line. The minimum is 1 the max is 10. Style Can be '0-Solid', '1-Dash', '2-Dot', '3-Dash Dot' or '4-Dash Dot Dot'. Simply the line can be solid or a series of dots etc. Code Examples ~~~~~~~~~~~~~ Leave the defaults and set the following properties : Delay 20 Enabled True Visible False Create a button and in its click event place the following code : fcline1.visible = True DoEvents ' Give animation time to complete fcline1.Enabled = False ' Turn animation off This would be the standard way of using the line control. FCShape ======= Description ~~~~~~~~~~~ Imitates the standard shape control only it has a little extra like the ability to include a shadow. Properties ~~~~~~~~~~ BackColor The colour behind the shape. This is the colour the whole control will be painted in first. This is normally set to the background colour of the form. BorderStyle Can be '0-None' or '1-Fixed Single'. This can provide a border for the control. If set, the border is drawn around the entire control. FillColor This is the colour of the shape itself. Locked Can be '0-Unlocked' or '1-Locked'. If Unlocked it works as normal. If Locked you cannot move the control from its current position. OffSet This is the gap between the shape and its shadow. The greater the Offset the further off the form the shape appears to be. It defaults to 2. PenColor This is the outline colour of the shape. If this is set to black then the shape will have a black outline. This does not affect the FillColor or the BackColor. Shadow Can be '0-None', '1-Right' or '2-Left'. If set to None the shape acts as normal. If set to Right then a shadow will appear to the right of the shape (how far right depends on the OffSet). If set to Left then the shadow will appear to the left of the shape. ShadowColor This is the colour of the shadow (if there is one). Shape The shapes available are : 0 - None 1 - Rectangle 2 - Square 3 - Circle 4 - Oval 10 - Triangle Right 11 - Triangle Up 12 - Triangle Left 13 - Triangle Down 14 - Diamond FCOddPic ======== Description ~~~~~~~~~~~ This control allows you to place a bitmap with a transparent background onto a form. All that's needed is a bitmap with all areas you want transparent set to Pure Black (the RGB values being {0, 0, 0}). If you want parts of the image to appear black then use a colour with RGB values {0, 0, 1} or something similar. Properties ~~~~~~~~~~ Picture Assign a picture as you would normally. Even if you intend to load the picture at run time, its best to see it during design time. Also the control will resize itself to best fit the image, but only at design time. To make it resize itself at run time would make it flicker too much. FCPshBtn ======== Description ~~~~~~~~~~~ This is a picture button that can have four images to represent four states (button being enabled and up or down, button being disabled and up or down). It can act like a ribbon button or like a push button. Properties ~~~~~~~~~~ AlignHorz Can be '0-Left', '1-Center' or '2-Right'. This is the horizontal alignment of the image. AlignVert Can be '0-Top', '1-Center' or '2-Bottom'. This is the vertical alignment of the image. BackColor The colour of the button. This can only be set to one of the 16 standard colours. Border If true a black border is drawn around the button making it stand out more. BorderWidth This sets the width of the bevels. The greater the width the easier to tell that a button has been pressed or not. Button Can be '0-Button' or '1-Ribbon'. If set to 0 then it acts like a standard button. If set to 1 it acts like a standard ribbon button (this means that the button will remain pressed until the user clicks on it again). HiliteColor This is the highlight colour for the bevel. PicDown When button is down this is the image that is displayed. '' Disabled When button is down but disabled this is the image displayed. PicUp When button is up this is the image displayed. '' Disabled When button is up but disabled this is image displayed. ShadowColor This is the shadow colour for the bevel. Stretch If the bitmap is smaller than the button it can be made to stretch to the size of the button. FCTxtBtn ======== Description ~~~~~~~~~~~ This imitates a standard button except the caption property is like FCLabel. It can also act like a ribbon button or a normal push button. Properties ~~~~~~~~~~ AlignHorz Can be '0-Left', '1-Center' or '2-Right'. This is the horizontal alignment of the caption. AlignVert Can be '0-Top', '1-Center' or '2-Bottom'. This is the vertical alignment of the caption. BackColor The colour of the button. This can only be set to one of the 16 standard colours. Border If true a black border is drawn around the button making it stand out more. BorderWidth This sets the width of the bevels. The greater the width the easier to tell that a button has been pressed or not. Button Can be '0-Button' or '1-Ribbon'. If set to 0 then it acts like a standard button. If set to 1 it acts like a standard ribbon button (this means that the button will remain pressed until the user clicks on it again). Caption This acts like the caption in FCLabel. ForeColor The colour of the caption (unless you change it within the caption). HiliteColor This is the highlight colour for the bevel. ShadowColor This is the shadow colour for the bevel. FCBtn ===== Description ~~~~~~~~~~~ This control is a combination of FCTxtBtn and FCPshBtn. The caption and picture are displayed at the same time. Properties ~~~~~~~~~~ These are all the same as FCTxtBtn and FCPshBtn. FCHotTxt ======== Description ~~~~~~~~~~~ It looks a little like a speech bubble with a shadow. Properties ~~~~~~~~~~ AlignHorz Can be '0-Left', '1-Center' or '2-Right'. This is the horizontal alignment of the caption. AlignVert Can be '0-Top', '1-Center' or '2-Bottom'. This is the vertical alignment of the caption. BackColor This is the background colour of the control. BorderStyle Can be '0-None' or '1-Fixed Single'. The control can be made stand out a little more by having a black border around the control. Caption Works like the FCLabel caption. ForeColor The colour of the caption (unless you change it within the caption). Line This can be set to True or False. If false the underline beneath the title is removed so the hottext looks more like a speech bubble. Locked Can be '0-Unlocked' or '1-Locked'. If Unlocked it works as normal. If Locked you cannot move the control from its current position. OffSet This is the gap between the bubble and its shadow. The greater the Offset the further off the form the bubble appears to be. Picture This is an image that will appear in the top right hand corner of the bubble. Pointer Can be '0-None', '1-Top Left', '2-Top Right', '3-Bottom Left' or '4-Bottom Right'. These are the four corners the pointer can be. Scrollbar This will be explained later under the heading Scrolling because it applies to a number of controls and takes some explaining. ShadowColor The colour of the shadow. WordWrap The ability to word wrap can be turned on or off. RunTime Only Properties ~~~~~~~~~~~~~~~~~~~~~~~ There are three RTOPs. They are used to help scrolling and will be explained under the Scrolling Section. FCChk ===== Description ~~~~~~~~~~~ This imitates a number of check box controls in a frame control. The check boxes can be standard or have a 3D look. The item captions are like FCLabels caption and so can have various styles and colours. Properties ~~~~~~~~~~ Alignment Can be '0-Left', '1-Right' or '2-Center'. This alignment of the frame caption. BackColor This is the background colour of the frame. BorderEffect Can be '0-None', '1-Raised', '2-Lowered', '3-Drop Shadow' or '4-Inset'. BorderStyle Can be '0-None' or '1-Fixed Single'. The frame can appear without a frame border. Caption This is the title caption of the frame. This can be left blank if you want. Contents If you double click this property or click on the '...' in the edit box a window will appear. This window lets you enter the captions for the check boxes. Each new line represents a new check box. These captions work like the FCLabel caption. They can change colour and style and be made move onto newlines. DisabledColor When the control is disabled this is the colour the captions change to. This is to stop them from changing to a dull grey. Item... These properties are like the standard font and style properties except they apply to the check box captions. High- LightColor The highlight colour for the bevels. Item- Alignment Can be '0-Left' or '1-Right'. This decides whether the check boxes and their captions are placed to the left or right of the frame. Item- ForeColor The colour of the item captions. RedItems This will change the colour of some of the items to red. If you set RedItems to 5 then the first and third items will be redrawn in red. ShadeColor The shadow colour for the bevels ShadowColor The colour of the shadow for the drop down shadow effect for the frame. Spacing The spacing between each check box, so they can be moved closer together or further apart. ThreeD If True the check boxes will have a 3D effect. TopMargin Dictates how far from the top of the frame the first check box will appear. Value This is where you find out which boxes have been selected. Each box has a default value assigned to it. The first check box is 1, the second is 2, the third is 4 the fourth is 8 and so on. This means that we can tell which boxes have been selected from the sum of the their values (ie) if fcchk1.value = 7 then the first three check boxes have been selected (1+2+4), if fcchk.value = 9 then the first and fourth boxes have been selected. FCOpt ===== Description ~~~~~~~~~~~ This imitates a number of option controls in a frame control. The options can be standard or have a 3D look. The item captions are like FCLabels caption and so can have various styles and colours. Properties ~~~~~~~~~~ These are the same as FCChk except one : Value This is where you find out which option was selected. The value is actually the caption of the item selected. So if we had three options called "first option", "second option" and "third option" and the user selected the second one then fcopt.value = "second option". FCSlate ======= Description ~~~~~~~~~~~ This control is simply a container. It is ment to keep other controls placed on it together. It has slightly less overhead than a picturebox. It has one added feature in that if you click with the right mouse button it brings the slate to the foreground. Properties It only has some standard properties. FCLabel ======= Description ~~~~~~~~~~~ This control allows the text in the caption to have different colours and styles. The caption can be word wrapped. Bevels can be placed around the label. The label can be wiped during run time. The text in the label can be scrolled. Properties ~~~~~~~~~~ AlignHorz Can be '0-Left', '1-Center' or '2-Right'. This is the horizontal alignment of the caption. AlignVert Can be '0-Top', '1-Center' or '2-Bottom'. This is the vertical alignment of the caption. BackColor This is the background colour of the control. BackStyle Can be '0-Opaque' or '1-Transparent'. Same effect as the backstyle in a standard label. BevelInner Can be '0-None', '1-Inset' or '2-Raised'. A bevel just inside the border of the control. BevelOuter Can be '0-None', '1-Inset' or '2-Raised'. A bevel along the border of the control. BevelWidth How wide the bevels are. Can make the label appear more inset or raised. BorderStyle Can be '0-None' or '1-Fixed Single'. The label can appear with or without a border. BorderWidth How far apart the inner bevel is from the outer bevel. The default is 0 so the inner bevel is just inside the label edge. Caption This is where the text for the label is input. The special characters allowed will be explained later. Delay This is used in the wipe. An average delay would be 10. Direction Can be '0-Left to Right', '1-Right to Left', '2-Top to Bottom' or '3-Bottom to Top'. This is the direction the wipe will go in. If it is 'Left to Right' then the wipe will start on the left hand side of the label and move towards the right. Fade Can be '0-Fade In' or '1-Fade Out'. This indicates at what time the wipe occurs. If it is 'Fade In' then the wipe will occur when the label is made visible giving the effect of the label being wiped onto the form. If it is 'Fade Out' then the label looks like its being wiped off the screen. ForeColor This is the general colour for the text. This can be changed within the caption using the special characters described later. HighLight This is the colour of the bevel highlights. Locked Can be '0-Unlocked' or '1-Locked'. If Unlocked it works as normal. If Locked you cannot move the control from its current position. Mode Can be '0-Single Pass' or '1-Double Pass'. If it is 'Single Pass' then the wipe (if any) occurs only once. If 'Double Pass' then the wipe occurs twice, the first time in the direction specified, the second time in the opposite direction. Scrollbar This will be explained later under the heading Scrolling because it applies to a number of controls and takes some explaining. ShadowColor This is the colour of the bevel shadow. WipeColor The colour used in the fade out wipe (normally the background colour which makes the label seem to disappear). WipeEnabled Can be '0-Disabled' or '1-Enabled'. Decides whether wiping is enabled or disabled. Its advisable to disable wiping immediately after label has wiped. An example of this will be given in the Code Example section. WordWrap The ability to word wrap can be turned on or off. RunTime Only Properties ~~~~~~~~~~~~~~~~~~~~~~~ There are three RTOPs. They are used to help scrolling and will be explained under the Scrolling Section. Code Examples ~~~~~~~~~~~~~ The following is an example of how to handle a label that wipes when made visible. Leave the defaults and set the following properties : Delay 20 Fade Fade In WipeEnabled True Visible False Create a button and in its click event place the following code : fclabel1.visible = True DoEvents ' Give wipe time to complete fclabel1.WipeEnabled = False ' Turn wipe off The Direction property was left at 'Left to Right' and the Mode property was left at 'Single Pass'. When the button is clicked, the label gets wiped onto the form from left to right in one go. The wipe was disabled so that if the label must redraw, it will not carry out the wipe but simply repaint itself in one go. The following is an example of how to handle a label that is wiped off the form. Leave the defaults and set the following properties : Delay 20 Fade Fade Out WipeColor background colour of form Create a button and in its click event place the following code : fclabel1.WipeEnabled = True ' Activate wipe fclabel1.Visible = False ' Make label disappear Again the Direction and Mode properties were left as they are. The label will wipe from left to right in the colour of the background so the label will appear to fade out. Embedding Colours & Styles in Captions ====================================== To set the colour of a piece of text use the following format : This is an ^nrexample ^lrof ^drdisplaying a caption. The word "example" will appear in Normal Red (^nr), "of" in Light Red (^lr) and "displaying a caption." in Dark Red (^dr). "This is an" will appear as ForeColor. You define each colour using two characters. The first denotes the intensity of the colour and the second the colour itself. Intensity n normal l light d dark Colours r red e green l blue w white b black g grey y yellow o brown p purple c cyan a orange To set the style of a piece of text use the following format : This is an ^si^example ^siu^of^sb^ displaying a ^sn^caption. The word "example" will appear in italics (^si^), "of" in italics and underlined (^siu^), "displaying a" in bold (^sb^) and "caption." in the normal font set in the properties. To set a style use the letter "s" and then any combination of the following "b" for bold, "i" for italic, "u" for underline, "s" for strikethrough and "n" for normal. To goto a new line use the following format : This is an|example of||displaying a caption. This would be displayed as follows : This is an example of displaying a caption. Use the following character to goto a newline "|". To underline one character in a caption use the following format : This is an &Example of &Displaying a caption. This would be displayed as follows : This is an Example of Displaying a caption. ~ ~ Any combination of the special characters described above can be used. Scrolling ========= Only two controls allow scrolling, FCLabel and FCHotTxt. Scrolling requires a small amount of Visual Basic code. It also requires something to control the scrolling such as a scroll bar control or even two buttons. Both controls have three RTOPs that help with scrolling and they are : LinesShowing This is how many lines of text can be seen at a time. Read Only. NumLines This is how many lines of text there are in total. It will be 0 if there is no space for text (ie) label is too thin, Read Only. TopLine The first line visible in the control. If the text has not been scrolled down this will be set to 1. Changing this value causes the text to scroll. Valid values are from {1 to (NumLines - LinesShowing + 1)}. If its set to outside this range it will reset itself to the nearest valid value. I will use FCLabel as an example to demonstrate how to implement scrolling, but all that follows applies to FCHotTxt as well. Suppose you have a label that isn't long enough for the amount of text. Create a scroll bar on the form. This will be used to control the scrolling. First of all you will need to set the maximum and minimum values of the scroll bar and optionally the large change value. In the Form Load Event type in the following piece of code : Dim x As Integer VScroll1.Min = 1 ' Scroll bar minimum value is 1 x = fclabel1.NumLines - fclabel1.LinesShowing + 1 If x < 1 Then x = 1 ' Make sure x isn't set below Minimum End If VScroll1.Max = x ' Scroll bar maximum value VScroll1.LargeChange = fclabel1.LinesShowing Setting VScroll1.LargeChange means that if the user clicks on the bar part of the scroll bar the text will scroll a labelful. Now we want the label to scroll if the scroll bar position changes, so type the following piece of code into the scroll bars Change Event : fclabel1.TopLine = VScroll1 This sets TopLine to the value stored in scrollbar every time the bar changes. A bit more work is involved in making the scroll bar appear as part of the label. If you are sure the text will need scrolling, place the scroll bar to the right of the text and change the ScrollBar property of the label to "1-Space Available". If you are not sure, place the scroll bar in the same position, but set its visible property to false, and set the labels ScrollBar property to "2-Space if Needed". In the Forms Load Event place the following piece of code : If fclabel1.NumLines > fclabel1.LinesShowing Then VScroll1.Visible = True End If